import os
#import re
import sys
import subprocess
import string

def _remove_ansi_escape(text):
  print("[%s]" % text)
  ansi_escape = re.compile(r'\x1b[^m]*m')
  print(ansi_escape.sub('', text))
  return ansi_escape.sub('', text)


def get_root():
  root = subprocess.check_output("git rev-parse --show-toplevel", shell=True)
  root = root.decode("utf-8")
  return root.replace("\n", "")


def set_path():
  #home = os.environ['HOME']
  home = get_root()
  os.environ['PYTHONPATH'] = os.path.join(home, "../coin_deploy")
  print(os.environ['PYTHONPATH'])
  sys.path.append(os.environ['PYTHONPATH'])

set_path()
